<?php
namespace Dybasedev\Dataman\Schema\Grammars;

use Illuminate\Support\Fluent;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Grammars\MySqlGrammar as Grammar;

class MySqlGrammar extends Grammar {

	/**
	 * Compile a auto-increment setter command.
	 *  
	 * @param  Blueprint $blueprint 
	 * @param  Fluent    $command   
	 * @return string               
	 */
	public function compileAutoIncrement(Blueprint $blueprint, Fluent $command)
	{
		$table = $this->wrapTable($blueprint);

		return 'alter table ' . $table . ' auto_increment = ' . $command->setter;
	}

	/**
	 * Compile engine setting.
	 * 
	 * @param  Blueprint $blueprint 
	 * @param  Fluent    $command   
	 * @return string               
	 */
	public function compileEngine(Blueprint $blueprint, Fluent $command)
	{
		$table = $this->wrapTable($blueprint);

		return 'alter table ' . $table . ' engine = ' . $command->engine;
	}
}
